import request from '@/utils/request'

// 查询角色列表
export function getList(query) {
  return request({
    url: '/base/auth/role/page',
    method: 'get',
    params: query
  })
}

// 查询角色列表
export function getList2(query) {
  return request({
    url: '/base/auth/role/page/user',
    method: 'get',
    params: query
  })
}

// 查询角色列表
export function rolegetList(query) {
  return request({
    url: '/base/auth/role/list',
    method: 'get',
    params: query
  })
}

// 新增角色
export function treeAdd(data) {
  return request({
    url: '/base/auth/role/add',
    method: 'post',
    data: data
  })
}

// 修改角色
export function treeEdit(data) {
  return request({
    url: '/base/auth/role/update',
    method: 'put',
    data: data
  })
}


// 删除角色
export function treeDel(roleId) {
  return request({
    url: '/base/auth/role/del/' + roleId,
    method: 'delete'
  })
}
// 删除角色
export function treeDel2(data) {
  return request({
    url: '/base/auth/role/user/del',
    method: 'post',
    data: data
  })
}

// 修改权限的树列表
export function roleTreeList(data) {
  return request({
    url: '/base/auth/role/resource/tree/'+data,
    method: 'get'
  })
}
// 修改角色权限
export function roleEditTree(data) {
  return request({
    url: '/base/auth/role/resource/update',
    method: 'put',
    data: data
  })
}

// 同意 用户注册
export function approved(data) {
  return request({
    url: '/base/auth/user/register/approved?ids=' + data,
    method: 'post',
  })
}
